﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 第三次作业_输出1_100000之间的质数
{
    class Program
    {
        static void Main(string[] args)
        {
            int temp = 0;
            for (int i = 1; i <= 100000; i++)
            {
                for (int j = 2; j <= i; j++)
                {
                    if (i % j == 0 && i != j)
                    {
                        break;
                    }
                    if (i == j)
                    {
                        //补齐空格，用于前段对齐
                        string stri = i.ToString();
                        char pad = ' ';
                        Console.Write(stri.PadRight(6, pad));
                        temp++;
                        if (temp % 10 == 0)
                        {
                            Console.WriteLine();
                        }
                    }
                }
            }
            Console.WriteLine("总数为" + temp);
            Console.ReadKey();
        }
    }
}
